package ynu.beggar.server.entities.DO;

import lombok.AllArgsConstructor;
import lombok.Data;
import ynu.beggar.server.entities.PO.ForumPostPO;

import java.time.format.DateTimeFormatter;

@Data
@AllArgsConstructor
public class ForumPostSummaryDO {
    private int postId;
    private Integer userId;
    private String title;
    private String userName;
    private String campus;
    private String inAddress;
    private String appointedTime;
    private String keyWord;
    private String foodDescription;
    private String headImgUrl;


    public ForumPostSummaryDO(ForumPostPO po) {
        this.postId = po.getPostId();
        this.userId = po.getUserId();
        this.title = po.getTitle();
        this.userName = po.getUserName();
        this.campus = po.getCampus();
        this.inAddress = po.getInAddress();
        this.appointedTime = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(po.getAppointedTime());
        this.keyWord = po.getKeyWord();
        this.foodDescription = po.getFoodDescription();
        this.headImgUrl = "headImg" + po.getUserId() + ".jpg";
    }
}
